const DUMMY_EVENTS = [
  {
    id: 'e1',
    title: 'Programming for everyone',
    description:
      'Everyone can learn to code! Yes, everyone! In this live event, we are going',
    location: 'Somestreet 25，12345 San Somewhereo',
    date: '2021-05-12',
    image: 'images/不3.jpg',
    isFeatured: true
  },
  {
    id: 'e2',
    title: 'Programming for everyone',
    description:
      'Everyone can learn to code! Yes, everyone! In this live event, we are going',
    location: 'Somestreet 25，12345 San Somewhereo',
    date: '2021-05-11',
    image: 'images/不1.jpg',
    isFeatured: false
  },
  {
    id: 'e3',
    title: 'Programming for aaa',
    description:
      'Everyone can learn to code! Yes, everyone! In this live event, we are going',
    location: 'Somestreet 25，12345 San Somewhereo',
    date: '2021-05-13',
    image: 'images/不2.jpg',
    isFeatured: false
  }
]
export function getFeaturedEvents () {
  return DUMMY_EVENTS.filter(event => event.isFeatured)
}
export function getAllEvents () {
  return DUMMY_EVENTS
}
export function getFilteredEvents (dateFilter) {
  const { year, month } = dateFilter
  let filteredEvents = DUMMY_EVENTS.filter(event => {
    const eventDate = new Date(event.date)
    return (
      eventDate.getFullYear() === year && eventDate.getMonth() === month - 1
    )
  })
  return filteredEvents
}

export function getEventById (id) {
  return DUMMY_DATA.find(event => event.id === id)
}
